﻿using GoodsModule.Application.Commands;
using GoodsModule.Application.Queries;
using MediatR;
using Microsoft.AspNetCore.Mvc;

namespace GoodsModule.Host.WebAPI.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class GoodsCategoryController(IMediator _mediator) : ControllerBase
    {
        [HttpGet]
        public async Task<List<Domain.GoodsCategoryAggregate.GoodsCategory>> GetList([FromQuery] GoodsCategoryGetLIstRes query)
        {
            return await _mediator.Send(query, HttpContext.RequestAborted);
        }

        [HttpPost]
        public async Task<Domain.GoodsCategoryAggregate.GoodsCategory> Create(CreateGoodsCategoryCommannd commannd)
        {
            return await _mediator.Send(commannd, HttpContext.RequestAborted);
        }

        [HttpDelete]
        public Task Delete(DeleteGoodsCategoryCommannd commannd)
        {
            return _mediator.Send(commannd, HttpContext.RequestAborted);
        }
    }
}
